<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateRbacUserRolesTable extends Migration {
    /**
     * Run the migrations.
     * @return void
     */
    public function up() {
        Schema::create('rbac_user_roles', function (Blueprint $table) {
            $table->increments('id')->comment('表备注：用户角色对应表');
            $table->integer('user_id')->comment('用户id');
            $table->integer('role_id')->comment('角色id');
            
            $table->dateTime('created_at')->nullable()->default(null);
            $table->dateTime('updated_at')->nullable()->default(null);
            
            $table->index(['user_id']);
        });
    }
    
    /**
     * Reverse the migrations.
     * @return void
     */
    public function down() {
        Schema::dropIfExists('rbac_user_roles');
    }
}
